package karma.main;

import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;

public class ItemELBody extends ItemArmor implements ISpecialArmor
{
    public static boolean ELBodyWorn;

    public ItemELBody(int i, EnumArmorMaterial enumarmormaterial, int j, int k)
    {
        super(i, enumarmormaterial, j, k);
    }

    public static void checkIfWorn(Minecraft minecraft)
    {
        if (minecraft.thePlayer.inventory.armorInventory[2] != null)
        {
            if (minecraft.thePlayer.inventory.armorInventory[2].getItem() == mod_KarmaCraft.ELBody)
            {
                ELBodyWorn = true;
            }
            else
            {
                ELBodyWorn = false;
            }
        }
        else
        {
            ELBodyWorn = false;
        }
    }

    public ArmorProperties getProperties(EntityLiving entityliving, ItemStack itemstack, DamageSource damagesource, double d, int i)
    {
        double d1;

        if (d == 1.0D)
        {
            d1 = 0.0D;
        }
        else if (d == 2D)
        {
            d1 = 0.5D;
        }
        else if (d == 3D)
        {
            d1 = 0.33333333333333331D;
        }
        else
        {
            d1 = 0.25D;
        }
        int damage = (int)(d * d1);
        ModLoader.getMinecraftInstance().thePlayer.inventory.armorInventory[2].damageItem(damage, ModLoader.getMinecraftInstance().thePlayer);
        return new ArmorProperties(0, d1, 0x7fffffff);
    }

    /**
     * Return an item rarity from EnumRarity
     */
    public EnumRarity getRarity(ItemStack itemstack)
    {
        return mod_KarmaCraft.ENCHANTED;
    }

    public int getArmorDisplay(EntityPlayer entityplayer, ItemStack itemstack, int i)
    {
        return 0;
    }

    public void damageArmor(EntityLiving entityliving, ItemStack itemstack, DamageSource damagesource, int i, int j)
    {
    }
}
